<template>
<div>
	<a-card  :title="notice.title">

	   <a-card-meta :title="notice.creater.name" :description="formatTime(notice.updateTime)">
	        <a-avatar slot="avatar" :src="notice.creater.avatar | avatar" />
		</a-card-meta>
		
		<div class="html" v-html="handleContent()">
			
		</div>

	</a-card>
</div>
		
</template>
<script>
import {findNotice} from '@/api/notice'
import moment from 'moment'
import {marked} from 'marked'

export default {
	name: 'NoticeDetail',
	data(){
		return {
			notice: {}
		}
	},
	created(){
		findNotice(this.$route.params.id).then(res => {
			this.notice = res.data
			console.log(res)
		}).catch(err => {
			
		})
	},
	filters: {
		avatar(name){
			return "http://localhost:8080/static/" + name
		}
	},
	methods: {
		formatTime(time){
		  return moment(time).format('YYYY-MM-DD HH:mm:ss')
		},
		handleContent(){
			return  marked.parse(this.notice.content)
		}
	}
}
</script>
<style scoped>
	.html {
		padding-top: 20px;
	}
</style>